package com.my.lab.activity;

import android.content.Context;
import android.graphics.Bitmap;
import android.graphics.BitmapFactory;
import android.graphics.Canvas;
import android.graphics.Color;
import android.graphics.Matrix;
import android.graphics.Paint;
import android.graphics.Paint.Style;

import com.my.lab.R;

public class PathView extends ViewBase {

    public PathView(Context context) {
        super(context);
    }

    @Override
    protected void onDraw(Canvas canvas) {
        super.onDraw(canvas);
        Bitmap bmp = BitmapFactory.decodeResource(getResources(), R.drawable.in_meeting);
        int angle = 0;
        // for(int i = 0 ; i < 6 ; i ++) {
      Paint paint = new Paint();
      paint.setColor(Color.RED);
      paint.setStyle(Style.FILL);
      paint.setAntiAlias(true);
      paint.setStrokeWidth(1);
        Matrix matrix = new Matrix();
        matrix.postScale(1.0f, 1.0f);
        matrix.postRotate(angle);
        Bitmap dstbmp = Bitmap.createBitmap(bmp, 0, 0, bmp.getWidth(), bmp.getHeight(), matrix, true);
        canvas.drawColor(Color.BLACK);
        canvas.drawBitmap(dstbmp, 100, 100, null);
        canvas.save(Canvas.ALL_SAVE_FLAG);
        canvas.restore();
        Matrix matrix2 = new Matrix();
        matrix2.postScale(1.0f, 1.0f);
        matrix2.postRotate(60);
        canvas.drawPoint(100, 100, paint);
        Bitmap dstbmp2 = Bitmap.createBitmap(bmp, 0, 0, bmp.getWidth(), bmp.getHeight(), matrix2, true);
        canvas.drawColor(Color.BLACK);
        canvas.drawBitmap(dstbmp2, 100, 100, null);
        angle = angle + 60;
        canvas.save(Canvas.ALL_SAVE_FLAG);
        canvas.restore();
        // }
        // Matrix matrix=new Matrix();
        // matrix.postScale(0.8f, 0.8f);
        // matrix.postRotate(45);
        // Bitmap dstbmp=Bitmap.createBitmap(bmp,0,0,bmp.getWidth(),
        // bmp.getHeight(),matrix,true);
        // canvas.drawColor(Color.BLACK);
        // canvas.drawBitmap(dstbmp, 10, 10, null);
    }
}
